Finishing Steps and Running the Application

Check if the current script is the main program (that is, it wasn't imported from another script) with the conditional if __name__ == "__main__":.

If the condition is true, call app.run(debug=True) to start the Flask development server with debug mode enabled. This will allow you to view detailed error messages in your browser if something goes wrong.

  1. 1
  2. 2
  3. 3
  1. # Run the Flask app
  2. if __name__ == "__main__":
  3. app.run(debug=True)

Now, the code will look like this:
Correct code reference

The code is now complete. Run the file app.py from a terminal shell using the command:

  1. 1
  1. python3.11 app.py

By default, Flask launches the application on LocalHost:5000. As displayed in the image,

  1. Launch the application by going to the Skills Network Library, going to Launch Application.
  2. Enter 5000 in the port number and launch the application window.

The final application looks like this.

ezgif com-video-to-gif